Started with the separated DB with the given code
[RRRRHHHH_Code] / ruralHouses client / src / gui / listOfBookingRequestsGUI.java
index 85d86e1..ba96f0d 100644 (file)
@@ -8,7 +8,6 @@ import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.rmi.Naming;
 import java.rmi.RemoteException;
-import java.util.Date;
 import java.util.Enumeration;
 import java.util.Vector;
 
@@ -23,7 +22,7 @@ import javax.swing.table.DefaultTableCellRenderer;
 import javax.swing.table.DefaultTableModel;
 
 import common.BookingInterface;
-import common.OfferInterface;
+
 import configuration.___IntNames;
 import domain.Booking;
 import domain.Offer;
@@ -63,16 +62,26 @@ public class listOfBookingRequestsGUI extends JFrame {
                setContentPane(contentPane);
                contentPane.setLayout(null);
 
-               this.bookings = this.off.getBookings();
+               BookingInterface bm = null;
+               
+               try {
+                       bm = (BookingInterface) Naming
+                                       .lookup(___IntNames.BookingManager);
+
+               } catch (Exception e1) {
+                       System.out.println("Error accessing remote authentication: "
+                                       + e1.toString());
+               }
+               try {
+                       this.bookings = bm.getOffersbookings(this.off);
+               } catch (RemoteException e1) {
+                       e1.printStackTrace();
+               }
+               
                JLabel lblNewLabel = new JLabel();
                lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 27));
                lblNewLabel.setBounds(23, 41, 536, 33);
                contentPane.add(lblNewLabel);
-               if (bookings.isEmpty())
-                       lblNewLabel
-                                       .setText("There are not bookings to be confirmed or denied");
-               else
-                       lblNewLabel.setText("List of bookings:");
                JScrollPane scrollPane = new JScrollPane();
                scrollPane.setBounds(new Rectangle(45, 305, 320, 116));
                scrollPane.setBounds(23, 113, 536, 271);
@@ -142,16 +151,22 @@ public class listOfBookingRequestsGUI extends JFrame {
                                        }
                                        ((DefaultTableModel) table.getModel()).removeRow(table
                                                        .getSelectedRow());
+                                       bookings.remove(book);
 
                                }
                        }
                });
-
-               if (this.bookings.get(0).getOffer().isBooked()) {
-                       btnDenyAddition.setEnabled(false);
-                       btnNewButton.setEnabled(false);
+               if (bookings.isEmpty())
+                       lblNewLabel
+                                       .setText("There are not bookings to be confirmed or denied");
+               else {
+                       lblNewLabel.setText("List of bookings:");
+                       if (this.bookings.get(0).getOffer().isBooked()) {
+                               btnDenyAddition.setEnabled(false);
+                               btnNewButton.setEnabled(false);
+                       }
                }
-
+               
                btnDenyAddition.setBounds(390, 395, 169, 25);
                contentPane.add(btnDenyAddition);